import request from '@/utils/request'
import requestApi from '@/utils/request-api'

// 获得企业管理分页
export function getCompanyPage(query) {
  return request({
    url: '/member/company/page',
    method: 'get',
    params: query
  })
}
// 获得招聘企业管理分页 （包含发布职位数量等）
export function getHireCompanyPage(query) {
  return request({
    url: '/recruitCompany/companyList',
    method: 'get',
    params: query
  })
}
// 获得认证后企业管理列表
export function getAuthedCompanyList(query) {
  return request({
    url: '/member/company/authenticationlist',
    method: 'get',
    params: query
  })
}
// 获得回收站职位详情
export function getRecoveryEnterpriseJobById(id) {
  return request({
    url: '/enterprise/enterprise-job/getRecoveryEnterpriseJobById?id=' + id,
    method: 'get'
  })
}
// 获得回收站职位列表
export function recoveryEnterpriseJobPage(data) {
  return request({
    url: '/enterprise/enterprise-job/recoveryEnterpriseJobPage',
    method: 'post',
    data: data
  })
}
// 批量还原回收站职位
export function updateBatchRecoveryEnterpriseJob(data) {
  return request({
    url: '/enterprise/enterprise-job/updateBatchRecoveryEnterpriseJob',
    method: 'put',
    data
  })
}

// 更新企业介绍信息
export function updateCompanyInfo(data) {
  return request({
    url: '/enterprise/company/update',
    method: 'put',
    data: data
  })
}
// 获得企业介绍信息，通过租户id拿到
export function getCompanyByLoginUser(data) {
  return new Promise((resolve, rejext) => {
    request({
      url: '/enterprise/company/getCompanyByLoginUser',
      method: 'get',
      params: data
    }).then(res => {
      if (res.code === 0 && res.data) {
        resolve(res)
      } else if (res.code === 0 && res.data === null) {
        rejext(res)
      } else {
        rejext(null)
      }
    })
  })
}
// 获得角色信息,判断当前企业账号是否为管理员
export function getIsAdmin(data) {
  return request({
    url: '/system/role/isAdmin',
    method: 'get',
    params: data
  })
}
// 创建招聘职位
export function createJob(data) {
  return request({
    url: '/enterprise/enterprise-job/create',
    method: 'post',
    data: data
  })
}
// 获得待发布招聘职位分页
export function getJobWaitExamineList(data) {
  return request({
    url: '/enterprise/enterprise-job/jobWaitExamineList',
    method: 'post',
    data: data
  })
}
// 获得已发布招聘职位分页
export function getJobExamineDoneList(data) {
  return request({
    url: '/enterprise/enterprise-job/jobExamineDoneList',
    method: 'post',
    data: data
  })
}
// 获得暂停发布招聘职位分页
export function getJobExamineStopList(data) {
  return request({
    url: '/enterprise/enterprise-job/jobExamineStopList',
    method: 'post',
    data: data
  })
}
// 更新招聘职位
export function updateJobInfo(data) {
  return request({
    url: '/enterprise/enterprise-job/update',
    method: 'put',
    data: data
  })
}
// 获得招聘职位
export function getJobInfo(data) {
  return request({
    url: '/enterprise/enterprise-job/get',
    method: 'get',
    params: data
  })
}
// 刷新职位日期
export function updateJobDate(data) {
  return request({
    url: '/enterprise/enterprise-job/updateJobDate',
    method: 'put',
    data: data
  })
}
// 批量置顶-取消置顶职位
export function setJobTopStatus(data) {
  return request({
    url: '/enterprise/enterprise-job/setJobTopStatus',
    method: 'put',
    data: data
  })
}
// 批量修改职位状态 （发布状态修改）
export function setJobStatus(data) {
  return request({
    url: '/enterprise/enterprise-job/setJobStatus',
    method: 'put',
    data: data
  })
}
// 删除职位
export function deleteJob(id) {
  return request({
    url: '/enterprise/enterprise-job/delete?id=' + id,
    method: 'delete'
  })
}
// 批量删除职位 /admin-api/enterprise/enterprise-job/deleteJob
export function deleteMutipleJob(data) {
  return request({
    url: '/enterprise/enterprise-job/deleteJob',
    method: 'delete',
    data: data
  })
}
//  获得招聘职位列表 通过ids
export function getEnterpriseJobList(data) {
  return request({
    url: '/enterprise/enterprise-job/list',
    method: 'get',
    params: data
  })
}
//  获得招聘职位列表 翻页
export function getEnterpriseJobPage(data) {
  return request({
    url: '/enterprise/enterprise-job/page',
    method: 'post',
    data: data
  })
}

// 各职位投递列表
export function getpageByJob(data) {
  return request({
    url: '/enterprise/curriculum-vitae-send-record/getpageByJob',
    method: 'post',
    data: data
  })
}
// 自主招聘列表
export function getEnterpriseCurriculumVitaePage(data) {
  return request({
    url: '/enterprise/curriculum-vitae/getEnterpriseCurriculumVitaePage',
    method: 'post',
    data: data
  })
}
// 人才夹列表页
export function getEnterpriseStudentPage(data) {
  return request({
    url: '/enterprise/curriculum-vitae/getEnterpriseStudentPage',
    method: 'post',
    data: data
  })
}

// 收藏简历
export function saveEnterpriseCollect(data) {
  return request({
    url: '/enterprise/curriculum-vitae-send-record/saveEnterpriseCollect',
    method: 'post',
    data: data
  })
}
// 添加备注
export function saveEnterpriseNotes(data) {
  return request({
    url: '/enterprise/curriculum-vitae-send-record/saveEnterpriseNotes',
    method: 'post',
    data: data
  })
}
// 历史备注
export function getEnterpriseNotesPage(data) {
  return request({
    url: '/enterprise/curriculum-vitae-send-record/getEnterpriseNotesPage',
    method: 'post',
    data: data
  })
}

// 自主招聘-获得用户简历分页
export function getResumePage(data) {
  return request({
    url: '/enterprise/curriculum-vitae/page',
    method: 'post',
    data: data
  })
}
//  根据职位获得简历投递记录分页
export function checkInfoByJob(data) {
  return request({
    url: '/enterprise/curriculum-vitae-send-record/checkInfoByJob',
    method: 'post',
    data: data
  })
}
// 创建面试邀约记录
export function createInvite(data) {
  return request({
    url: '/enterprise/interview-invite/createList',
    method: 'post',
    data: data
  })
}
// 获得面试邀约列表分页
export function getInvitationRecord(data) {
  return request({
    url: '/enterprise/interview-invite/page',
    method: 'post',
    data: data
  })
}
//  更新面试邀约
export function updateInvite(data) {
  return request({
    url: '/enterprise/interview-invite/update',
    method: 'post',
    data: data
  })
}
//  获得用户简历(原始简历) todo 报错提示缺少用户id
export function getUserResume(data) {
  return request({
    url: '/enterprise/curriculum-vitae/get',
    method: 'get',
    params: data
  })
}
// 获得用户简历(原始简历),解决老接口报错，新接口
export function getNosendResume(data) {
  return request({
    url: '/enterprise/curriculum-vitae/getNosend',
    method: 'get',
    params: data
  })
}
// 获得简历投递记录
export function getCopyResume(data) {
  return request({
    url: '/enterprise/curriculum-vitae-send-record/get',
    method: 'get',
    params: data
  })
}
//  企业直接面试邀约
export function inviteByCompany(data) {
  return request({
    url: '/enterprise/interview-invite/inSend',
    method: 'post',
    data: data
  })
}
// 获得面试邀约反馈
export function getInviteFeedback(data) {
  return request({
    url: '/enterprise/interview-invite/invitedFeedback',
    method: 'get',
    params: data
  })
}

// 导出企业招聘信息
export function getCompanyRecommend(query) {
  return request({
    url: '/recruitCompany/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}
//  导出企业招聘职位
export function exportCompanyJob(query) {
  return request({
    url: '/member/job/admin/export-excel',
    method: 'post',
    data: query,
    responseType: 'blob'
  })
}
// 导出企业用户信息
export function exportCompanyUser(query) {
  return request({
    url: '/member/company/user/exportExcel',
    method: 'post',
    data: query,
    responseType: 'blob'
  })
}
// 简历导出
export function exportStudentCurriculum(query) {
  return request({
    url: '/member/student-curriculum-vitae/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}
//   学生导出
export function exportStudentInfo(query) {
  return request({
    url: '/member/student/export-excel',
    method: 'post',
    data: query,
    responseType: 'blob'
  })
}
// 运营端，职位定时发布、定时暂停发布
export function updateJobFixed(data) {
  return request({
    url: '/member/job/updateJobFixed',
    method: 'put',
    data: data
  })
}
// 企业端，职位定时发布、定时暂停发布
export function updateEnterpriseJobFixed(data) {
  return request({
    url: '/enterprise/enterprise-job/updateEnterpriseJobFixed',
    method: 'put',
    data: data
  })
}
// 运营端-招聘统计-招聘职位状况
export function getJobAndinvitCountNew(query) {
  return request({
    url: '/recruitCompany/getJobAndinvitCountNew',
    method: 'get',
    params: query
  })
}
// 运营端-招聘统计-企业状况
export function getCompanyInfoCount(query) {
  return request({
    url: '/recruitCompany/getCompanyInfoCount',
    method: 'post',
    params: query
  })
}
// 运营端-招聘统计-学生状况
export function getStudentInfoCount(query) {
  return request({
    url: '/recruitCompany/getStudentInfoCount',
    method: 'post',
    params: query
  })
}
// 运营端-招聘统计，获取日增流量信息
export function getDayFlowInfo(query) {
  return request({
    url: '/infra/config/getDayFlowInfo',
    method: 'get',
    params: query
  })
}
// 运营端-招聘统计，获取日增流量信息
export function updateDayFlowInfo(query) {
  return request({
    url: '/infra/config/updateDayFlowInfo',
    method: 'post',
    data: query
  })
}
// 运营端-招聘统计，按模块统计访问量
export function getGropViewCount(query) {
  return request({
    url: '/system/operate-log/group/count',
    method: 'get',
    params: query
  })
}
// 运营端-招聘统计，按月统计访问量
export function getMonthViewCount(query) {
  return request({
    url: '/system/operate-log/month/count',
    method: 'get',
    params: query
  })
}
// 接口访问量，展示平台预览量
export function getOperateLogCount(query) {
  return request({
    url: '/system/operate-log/count',
    method: 'get',
    params: query
  })
}
// 统计看板 学生用户注册数
export function getRegisterStudentCount(query) {
  return request({
    url: '/member/student/regist/count',
    method: 'get',
    params: query
  })
}
// 统计看板 企业用户注册数
export function getRegisterCompanyCount(query) {
  return request({
    url: '/member/company/regist/count',
    method: 'get',
    params: query
  })
}
// 企业-平台概览
export function getEnterpriseJobCensus(query) {
  return request({
    url: '/enterprise/enterprise-job/getEnterpriseJobCensus',
    method: 'get',
    params: query
  })
}
// 企业-职位应聘
export function getEnterpriseJobCensusById(query) {
  return request({
    url: '/enterprise/enterprise-job/getEnterpriseJobCensusById',
    method: 'get',
    params: query
  })
}
// 推送管理分页
export function getPushManagePage(data) {
  return request({
    url: '/system/push-manage/page',
    method: 'post',
    data: data
  })
}
// 更新推送管理
export function updatPushManage(data) {
  return request({
    url: '/system/push-manage/update',
    method: 'put',
    data: data
  })
}
//  获得推送管理
export function getPushManage(query) {
  return request({
    url: '/admin-api/system/push-manage/get',
    method: 'get',
    params: query
  })
}
// 删除推送管理
export function deletePushManage({ id }) {
  return request({
    url: '/system/push-manage/delete?id=' + id,
    method: 'delete'
  })
}
// 启用立即推送
export function nowPushManage(id) {
  return request({
    url: `system/push-manage/nowPushMessage?id=${id}`,
    method: 'get'
  })
}
// /admin-api/system/push-manage/create 创建推送管理
export function createPushManage(data) {
  return request({
    url: '/system/push-manage/create',
    method: 'post',
    data: data
  })
}
//  返回学生模块访问量分布数据
export function getStudentGroupCount(query) {
  return requestApi({
    url: '/public/user/group/count',
    method: 'get',
    params: query
  })
}
// 在【职位列表】设置职位置顶/取消置顶，不需要传状态，根据orderNum大于等于0 表示置顶，其他状态表示未置顶
export function setJobTopInList(data) {
  return request({
    url: '/member/job/updateOrderNum',
    method: 'put',
    data
  })
}
// 在【企业列表】设置企业置顶/取消置顶，不需要传状态，根据orderNum大于等于0 表示置顶，其他状态表示未置顶
export function setCompanyTopInList(data) {
  return request({
    url: '/member/company/updateOrderNum',
    method: 'put',
    data
  })
}
